package com.hnhcyy.goods.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.hnhcyy.goods.pojo.Spkfklack;

/**
 * 缺货登记
 * @author sheyongjun  
 * @date 2019年2月13日
 */
public interface SpkfklackMapper {

	@Insert("insert into spkfklack(sjid,spid,yjdhrq,lcreated,reason,spmch,fqty,dw,zrr) "+
			" values (#{sjid},#{spid},#{yjdhrq},#{lcreated},#{reason},#{spmch},#{fqty},#{dw},#{zrr})")
	public int insert(Spkfklack item);
	
	@Delete("delete from spkfklack where lid=#{lid}")
	public int delete(Long lid);
	
	@Delete("delete from spkfklack where spid = #{spid}")
	public int deleteBySpidAndSjid(Spkfklack spkfklack);
	
	@Update("update spkfklack set sjid=#{sjid},spid=#{spid},yjdhrq=#{yjdhrq},lcreated=#{lcreated},reason=#{reason},spmch=#{spmch},fqty=#{fqty},dw=#{dw},zrr=#{zrr} "+
			" where lid=#{lid}")
	public int update(Spkfklack item);
	
	@Select("select lid,sjid,spid,yjdhrq,lcreated,reason,spmch,fqty,dw,zrr from spkfklack where lid=#{lid}")
	public Spkfklack select(Long lid);
	
	/**
	 * 根据商品ID查询缺货信息
	 * @author sheyongjun
	 * @date 2019年2月13日
	 */
	@Select("select yjdhrq,reason,spmch,fqty,dw from spkfklack where spid=#{spid}")
	public Spkfklack selectById(String spid);
	
	/**
	 * 查询缺货列表
	 * @param queryParam
	 * @return
	 */
	public List<Spkfklack> listSpkfklack(Spkfklack queryParam);
	
	/**
	 * 插入缺货记录
	 * @param spkfklack
	 * @return
	 */
	public int insertSpkfklack(Spkfklack spkfklack);
	
	/**
	 * 更新缺货记录
	 * @param spkfklack
	 * @return
	 */
	public int updateSpkfklack(Spkfklack spkfklack);
}
